package com.campus.mapper;

import com.campus.domain.entity.LostItemLike;
import org.apache.ibatis.annotations.*;

/**
 * 失物点赞Mapper
 */
@Mapper
public interface LostItemLikeMapper {
    
    // 插入点赞
    @Insert("INSERT INTO lost_item_likes(item_id, user_id) VALUES(#{itemId}, #{userId})")
    int insert(LostItemLike like);
    
    // 删除点赞
    @Delete("DELETE FROM lost_item_likes WHERE item_id = #{itemId} AND user_id = #{userId}")
    int delete(@Param("itemId") Long itemId, @Param("userId") Long userId);
    
    // 查询是否已点赞
    @Select("SELECT COUNT(*) FROM lost_item_likes WHERE item_id = #{itemId} AND user_id = #{userId}")
    int exists(@Param("itemId") Long itemId, @Param("userId") Long userId);
}

